. ./scripts/basic_pkg_management.ps1

function Install-R-KERNEL{
    # also need to set r.rpath and r.rterm to correct conda R.exe radian.exe
    # use gcm to see the path

    # use conda to manage pkg is somewhat better
    # the script here should not be modified

    echo "Install r-pkgs using conda; add a r- prefix"

    echo "Install languageserver : for code completion \n(the kernel is installed also...)"
    conda install r-languageserver -y

    Install-PIP
    Install-JUPYTER

    echo "Install radian : ipython counter part in R"
    pip install radian

    echo "Install irkernel : to use notebook with R"
    conda install r-irkernel -y

}

function Install-R-PKG{
    echo "Install tidyverse ..."
    conda install r-tidyverse -y
    echo "Installing basic dependency for svg format graph"
    conda install r-cairo -y
}

function Install-RSTUDIO{
    # RStudio requires non-conda R
    winget install -e --id RProject.R
    winget install -e --id RStudio.RStudio.OpenSource
}

Activate-ENV("r")